package net.dopan.pigframe.core.bean.config;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Package: net.dopan.pigframe.core.bean.config
 * @Title: FilterIgnorePropertiesConfig
 * @Description: 获取配置文件的ignore配置信息
 * @author: 刘宽
 * @date: 2018/10/10 11:11
 */
@Data
@Configuration
@Component("filterIgnorePropertiesConfig")
@RefreshScope
@ConditionalOnExpression("!'${ignore}'.isEmpty()")
@ConfigurationProperties(prefix = "ignore")
public class FilterIgnorePropertiesConfig {

    private List<String> urls = new ArrayList<>();

    private List<String> clients = new ArrayList<>();

    private Map<String, ServiceDetailBean> serviceDetails = new HashMap<>();

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    @Builder
    public static class ServiceDetailBean {
        private String serviceBean;

        private String serviceMethod;
    }
}
